package com.zxl.config;

import com.zxl.constants.MQConstants;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @packageName com.zxl.config
 * @ClassName
 * @Author zxl
 * @Description //TODO
 * @date
 **/
@Configuration
public class MQConfig {
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange(MQConstants.AUTH_EXCHANGE,true,false);
    }

    @Bean
    public Queue queue(){
        return new Queue(MQConstants.AUTH_QUEUE,true,false,false);
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(topicExchange()).with("auth.*");
    }
}

